<template>
  <div class="left">
    <!-- <van-sidebar
      v-model="activeKey"
      v-for="(item, index) in newarr2"
      :key="index"
    > -->
    {{ item }}
    <van-sidebar>
      <van-sidebar-item title="热门搜索" to="/findright" />

      <van-sidebar-item title="原创" to="/original" />

      <van-sidebar-item title="主题" to="/title" />
      <van-sidebar-item title="壁纸" />
      <van-sidebar-item title="头像" />
      <van-sidebar-item title="表情" />
      <van-sidebar-item title="影视" />
      <van-sidebar-item title="动漫" />
      <van-sidebar-item title="爱豆" />
      <van-sidebar-item title="动图" />
      <van-sidebar-item title="文字" />
      <van-sidebar-item title="素材" />
    </van-sidebar>
  </div>
</template>
<script>
// import axios from "axios";
export default {
  data() {
    return {
      activeKey: 0,
    };
  },
  created() {
    if (sessionStorage.getItem("store")) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(sessionStorage.getItem("store"))
        )
      );
    }

    //在页面刷新时将vuex里的信息保存到sessionStorage里
    window.addEventListener("beforeunload", () => {
      sessionStorage.setItem("store", JSON.stringify(this.$store.state));
    });

    this.$store.dispatch("getnavleft", { url: "/data/one" });
  },
  computed: {
    newarr2() {
      return this.$store.state.searchleft.newarr1;
    },
  },
  mounted() {
    console.log(this.$store.state.searchleft.newarr1);
  },
};
</script>
<style scoped>
.left {
  width: 0.9rem;
  height: 8rem;
  margin-top: 0.48rem;
  background-color: #fafafa;
  float: left;
  text-align: center;
  overflow-y: scroll;
  margin-right: 0.12rem;
}
.left van-sidebar-item:first-child {
  font-size: 0.16rem;
  color: #fd2b2a;
  height: 0.25rem;
  line-height: 0.25rem;
  background-color: #ffffff;
  width: 100%;
  text-align: left;
  text-indent: 0.06rem;
  margin-left: 0.04rem;
  border-left: 0.03rem solid #fd2b2a;
}
.left van-sidebar-item {
  line-height: 0.4rem;
  color: #6a6a6a;
  font-size: 0.14rem;
}
</style>